package array

func findTargetSumWays(nums []int, target int) int {

	res := 0
	var helper func(index int, sum int)
	helper = func(index int, sum int) {
		if index == len(nums) {
			if sum == target {
				res++
			}
			return
		}

		helper(index+1, sum-nums[index])
		helper(index+1, sum+nums[index])
	}
	helper(0, 0)
	return res
}
